package com.springday2annotate;


import com.springday2annotate.config.SpringConfig;
import com.springday2annotate.dao.BookDao;
import com.springday2annotate.dao.impl.BookDaoImpl;
import com.springday2annotate.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import javax.sql.DataSource;

public class App {
    public static void main(String[] args) {
//        获取IOC容器
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(SpringConfig.class); // 加载配置类初始化容器

//        BookService bookService =(BookService) ctx.getBean(BookService.class);
//        bookService.save();

//        第三方bean
        DataSource dataSource = ctx.getBean(DataSource.class);
        System.out.println(dataSource);
    }
}
